package com.heima.estatemanagement.domain;


import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Table;
import java.sql.Timestamp;
import java.util.Date;


public class TbParkingUse {

    private long id;
    private long communityId;
    private String name;
    private String code;
    private String carNumber;
    private long carId;
    private String picture;
    private long ownerId;
    private String userName;
    private String telephone;
    private String useType;
    private String paymentStatus;
    private long totalFee;
    private java.sql.Timestamp createTime;
    private java.sql.Timestamp updateTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date startTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endTime;
    private String contractStatus1;
    private String contractStatus2;
    public String contractStatus;

    public long getCarId() {
        return carId;
    }

    public void setCarId(long carId) {
        this.carId = carId;
    }

    public void setContractStatus(String contractStatus) {
        this.contractStatus = contractStatus;
    }

    public String getContractStatus() {
        int conStatus1 = Integer.valueOf(contractStatus1);
        int conStatus2 = Integer.valueOf(contractStatus2);
        if (0>=conStatus1) {
            return "未执行";
        } else if (30<=conStatus2) {
            return "执行中";
        } else if (30>conStatus2&&conStatus2>0) {
            return "快到期";
        } else {
            return "已结束";
        }
    }


    public String getContractStatus1() {
        return contractStatus1;
    }

    public void setContractStatus1(String contractStatus1) {
        this.contractStatus1 = contractStatus1;
    }

    public String getContractStatus2() {
        return contractStatus2;
    }

    public void setContractStatus2(String contractStatus2) {
        this.contractStatus2 = contractStatus2;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getCommunityId() {
        return communityId;
    }

    public void setCommunityId(long communityId) {
        this.communityId = communityId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getCarNumber() {
        return carNumber;
    }

    public void setCarNumber(String carNumber) {
        this.carNumber = carNumber;
    }

    public String getPicture() {
        return picture;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public long getOwnerId() {
        return ownerId;
    }

    public void setOwnerId(long ownerId) {
        this.ownerId = ownerId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getUseType() {
        return Integer.valueOf(useType) == 0 ? "购买" : "租售";
    }

    public void setUseType(String useType) {
        this.useType = useType;
    }

    public String getPaymentStatus() {
        return Integer.valueOf(paymentStatus) == 1 ? "已付款" : "未付款";
    }

    public void setPaymentStatus(String paymentStatus) {
        this.paymentStatus = paymentStatus;
    }

    public long getTotalFee() {
        return totalFee;
    }

    public void setTotalFee(long totalFee) {
        this.totalFee = totalFee;
    }

    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    @Override
    public String toString() {
        return "TbParkingUse{" +
                "id=" + id +
                ", communityId=" + communityId +
                ", name='" + name + '\'' +
                ", code='" + code + '\'' +
                ", carNumber='" + carNumber + '\'' +
                ", picture='" + picture + '\'' +
                ", ownerId=" + ownerId +
                ", userName='" + userName + '\'' +
                ", telephone='" + telephone + '\'' +
                ", totalFee=" + totalFee +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", startTime=" + startTime +
                ", endTime=" + endTime +
                '}';
    }
}
